package com.itheima.rabbitmq.listener;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

import java.nio.charset.StandardCharsets;

/**
 * @author : [chenxys]
 * @version : [v1.0]
 * @Description : 通配符消息监听3
 * @createTime : [2022/6/23 20:23]
 */
public class TopicListenerWell2 implements MessageListener {
    @Override
    public void onMessage(Message message) {
        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
        System.out.printf("通配符#监听器2：接收路由名称为: %s，路由键为：%s，队列名为：%s的消息：%s \n",
                message.getMessageProperties().getReceivedExchange(),
                message.getMessageProperties().getReceivedRoutingKey(),
                message.getMessageProperties().getConsumerQueue(),
                msg);
    }
}
